package com.funsport.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.funsport.entity.VenueBooking;
import com.funsport.dto.request.VenueBookingRequest;
import com.funsport.dto.response.VenueBookingResponse;
import com.funsport.dto.response.AvailableTimeSlot;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 场地预订服务接口
 */
public interface IVenueBookingService extends IService<VenueBooking> {
    
    /**
     * 创建预订
     * 
     * @param request 预订请求
     * @param userId 用户ID
     * @return 预订ID
     */
    Long createBooking(VenueBookingRequest request, Long userId);
    
    /**
     * 获取预订详情
     */
    VenueBookingResponse getBookingDetail(Long bookingId);
    
    /**
     * 获取用户预订列表
     */
    Page<VenueBookingResponse> getUserBookings(Long userId, Integer page, Integer pageSize, String status);
    
    /**
     * 获取场地预订列表
     */
    Page<VenueBookingResponse> getVenueBookings(Long venueId, Integer page, Integer pageSize, String status);
    
    /**
     * 获取所有预订列表（管理员）
     */
    Page<VenueBookingResponse> getAllBookings(Integer page, Integer pageSize, String status, Long venueId, Long userId);
    
    /**
     * 确认预订
     */
    void confirmBooking(Long bookingId, Long operatorId);
    
    /**
     * 取消预订
     */
    void cancelBooking(Long bookingId, Long userId);
    
    /**
     * 完成预订
     */
    void completeBooking(Long bookingId);
    
    /**
     * 检查时间冲突
     */
    boolean hasTimeConflict(Long venueId, LocalDateTime startTime, LocalDateTime endTime, Long excludeBookingId);
    
    /**
     * 获取场地可用时间段
     */
    List<AvailableTimeSlot> getAvailableTimeSlots(Long venueId, LocalDateTime date);
    
    /**
     * 获取场地在指定日期的预订列表
     */
    List<VenueBookingResponse> getBookingsByDate(Long venueId, LocalDateTime date);
}

